<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>step 4</title>
</head>

<body>

    <script>
        console.log('start evaluating string splicing')
        const start2 = Date.now()
        let str = ''
        for (var i = 0; i < 9999999; i++) {
            str += '1'
        }
        const end2 = Date.now()
        console.log(`string splicing run time: ${end2 - start2}`)

        console.log('--------------------------')

        console.log('start evaluating array concatenation')
        const start1 = Date.now()
        const arr = []
        for (var i = 0; i < 9999999; i++) {
            arr.push('1')
        }
        arr.join('')
        const end1 = Date.now()
        console.log(`array splicing run time: ${end1 - start1}`)
    </script>
</body>

</html>